let timeStamp = require('time-stamp');

// 随机订单号
let randomOrder = ()=>{
    let num = Math.floor(Math.random() * 1000000);
    return timeStamp('YYYYMMDDHHmmss') + num; // 生成唯一的时间戳
}

// 随机验证码
let randomCode = (length = 4)=>{
    let num = ''
    for (let i = 0; i < length; i++) {
        num += Math.floor(Math.random() * 10)
    }
    return num;
}

module.exports = {
    randomOrder,
    randomCode
}
